<?php
declare(strict_types=1);

namespace app\controller;

use app\common\Backend;
use app\service\RoutesService;

class Routes extends Backend
{
    public function initialize()
    {
        parent::initialize();
        $this->service = new RoutesService();
    }

    //重写index方法
    public function index()
    {
        $uid = request()->uid;
        //调用路由服务中树形结构
        $result = $this->service->routesByTree($uid);
        if($result){
            return success($result, 'success');
        }else{
            return error('未找到有效数据');
        }
    }

}

